package com.example.petplatform.dao;

import com.example.petplatform.entity.Admin;
import com.example.petplatform.entity.Users;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;

@Repository
public interface LoginDao extends Mapper<Users> {

    Admin adminLogin(@Param("username") String username, @Param("password") String password);

    Users userLogin(@Param("username") String username, @Param("password") String password);

    Users getUserByUsername(@Param("username") String username);

    @Insert("INSERT INTO users(username, password, name, avatar, role, phone_number, created_at, updated_at) " +
            "VALUES(#{username}, #{password}, #{name}, #{avatar}, #{role}, #{phone_number}, NOW(), NOW())")
    int insertUserSelective(Users users);

}
